﻿using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using Microsoft.Office.Interop.Excel;

namespace WFL.Office.Excel
{
    public class ExcelFont : IDisposable
    {
        public string Name
        {
            get { return _font.Name.ToString(); }
            set { _font.Name = value; }
        }

        public double Size
        {
            get { return (double)_font.Size; }
            set { _font.Size = value; }
        }

        public bool Bold
        {
            get { return (bool)_font.Bold; }
            set { _font.Bold = value; }
        }

        public bool Italic
        {
            get { return (bool)_font.Italic; }
            set { _font.Italic = value; }
        }

        public UnderlineStyle Underline
        {
            get { return (UnderlineStyle)_font.Underline; }
            set { _font.Underline = value; }
        }

        private Font _font;

        internal ExcelFont(Font font)
        {
            _font = font;
        }


        #region IDisposable 成员

        public void Dispose()
        {
            if (_font != null)
            {
                Marshal.ReleaseComObject(_font);
                _font = null;
            }
        }

        #endregion

    }
}
